$(function () {
    window.onload = function () {
        $.ajax({
            url: 'http://localhost:3000/report/new',
            type: 'get',
            success: function (report) {
                // console.log(report);
                var rearr = '';
                $.each(report, function (i, ele) {
                    rearr += `
                    <div class="new-box">
                    <img class="bgimg" src=${ele.img}>
                    <div class="mban">
                        <p>${ele.text}</p>
                        <span class="author">
                            <img src="../img/small/tx.jpg">
                        </span>
                        <span class="navRed">${ele.uName}</span>
                        <span>${ele.endTime}</span>
                        <span class="rimg">
                            <img src="../img/small/xin.png">
                            <i>3</i>
                            <img src="../img/small/reply.png">
                            <i>3</i>
                        </span>
                    </div>
                    <div class="wbox">
                        <p> 关于格林威特空气净化器还有4篇报告, 点击查看</p>
                    </div>
                </div>
                    `
                })
                $('.jia-new').append(rearr);
            }
        })
        // 最热部分
        $.ajax({
            url: 'http://localhost:3000/report/new',
            type: 'get',
            success: function (rehot) {
                // console.log(report);
                var hotarr = '';
                $.each(rehot, function (i, dom) {
                    hotarr += `
                    <div class="new-box">
                    <img class="bgimg" src=${dom.img}>
                    <div class="mban">
                        <p>${dom.text}</p>
                        <span class="author">
                            <img src="../img/small/tx.jpg">
                        </span>
                        <span class="navRed">${dom.uName}</span>
                        <span>${dom.endTime}</span>
                        <span class="rimg">
                            <img src="../img/small/xin.png">
                            <i>3</i>
                            <img src="../img/small/reply.png">
                            <i>3</i>
                        </span>
                    </div>
                    <div class="wbox">
                        <p> 关于格林威特空气净化器还有4篇报告, 点击查看</p>
                    </div>
                </div>
                    `
                })
                $('.jia-hot').append(hotarr);
            }
        })
    }
    $('.more').on({
        click: function () {
            $('.jia-hot,.jia-new').css({
                'overflow': 'visible',
                'height': '100%'
            });
            $(this).remove('.more');
        },
    });
})